<template>
  <div style="padding: 250px">
    <div id="words" style="font-weight: bold; font-size: 25px;">
      考试已经结束，{{time}}秒后将自动返回……
    </div>
  </div>
</template>

<script>
export default {
  name: 'FinishExam',
  data () {
    return {
      time: 5
    }
  },
  created () {
    this.countDown()
  },
  methods: {
    countDown () {
      let that = this
      var time = 5
      var tim = setInterval(function () {
        time--
        document.getElementById('words').innerHTML = '考试已经结束，' + time + '秒后将自动返回……'
        if (time <= 0) {
          clearInterval(tim)
          that.$router.push('/student/exam')
        }
      }, 1000)
    }
  }
}
</script>

<style scoped>
/*#words {*/
/*  position: absolute;*/
/*  top: 50%;*/
/*  left: 50%;*/
/*  height: 30%;*/
/*  width: 50%;*/
/*  margin: -15% 0 0 -25%;*/
/*}*/
</style>
